﻿<common:LayoutAwarePage
    x:Name="pageRoot"
    x:Class="Blocks.InstructionPage"
    DataContext="{Binding DefaultViewModel, RelativeSource={RelativeSource Self}}"
    IsTabStop="false"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Blocks"
    xmlns:common="using:Blocks.Common"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Page.Resources>

        <!-- TODO: Delete this line if the key AppName is declared in App.xaml -->
        <x:String x:Key="AppName">My Application</x:String>
    </Page.Resources>

    <!--
        This grid acts as a root panel for the page that defines two rows:
        * Row 0 contains the back button and page title
        * Row 1 contains the rest of the page layout
    -->
    <Grid>
        <Grid.Background>
            <ImageBrush ImageSource="Images/Background.jpg"/>
        </Grid.Background>
        <Grid.RowDefinitions>
            <RowDefinition Height="140"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!-- Back button and page title -->
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Button x:Name="backButton" Click="GoBack" IsEnabled="{Binding Frame.CanGoBack, ElementName=pageRoot}" Style="{StaticResource BackButtonStyle}" VerticalAlignment="Center" Margin="36,0,36,7"/>
            <TextBlock x:Name="pageTitle" Grid.Column="1" Style="{StaticResource PageHeaderTextStyle}" Text="Heading 2" Margin="0,45,40,55" FontSize="50.667" VerticalAlignment="Center"/>
            <TextBlock x:Name="pageSubTitle" Grid.Column="1" HorizontalAlignment="Left" Margin="0,0,0,-1.06" TextWrapping="Wrap" Text="Your Sub Header Here" VerticalAlignment="Bottom" FontFamily="Segoe UI" FontSize="26.667"/>
        </Grid>
        
        <ScrollViewer x:Name="MainScroll" HorizontalAlignment="Left" Margin="0" Grid.Row="1" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled">
            <StackPanel Background="Transparent" HorizontalAlignment="Left" Height="526" Margin="120,25,0,0" VerticalAlignment="Top" Width="1170" Orientation="Horizontal">
                <Grid HorizontalAlignment="Left" Height="434" Margin="0,0,0,0" Width="207" VerticalAlignment="Top">
                    <Image Margin="0" Source="Images/Instruction-01.png" Stretch="Fill" Width="207" Height="434" HorizontalAlignment="Left" VerticalAlignment="Top"/>
                    <Grid HorizontalAlignment="Left" Height="51" Margin="0" VerticalAlignment="Bottom" Width="207" Background="#E5231F20">
                        <TextBlock HorizontalAlignment="Center" Margin="0,0,0,0" TextWrapping="Wrap" Text="Heading 2" VerticalAlignment="Center" FontFamily="Segoe UI" FontSize="26.667"/>
                    </Grid>
                </Grid>
                <Grid HorizontalAlignment="Left" Height="434" Margin="10,0,0,0" Width="875" VerticalAlignment="Top" Background="#FF0CAABF">
                    <TextBlock HorizontalAlignment="Left" Height="434" Margin="0" TextWrapping="Wrap" VerticalAlignment="Top" Width="875" FontFamily="Segoe UI" FontSize="24" Padding="10,5,0,0"/>
                </Grid>
            </StackPanel>
        </ScrollViewer>
        
        <Grid x:Name="gridSnap" Visibility="Collapsed" Grid.Row="1">
            <StackPanel Margin="15,0,20,20" Orientation="Vertical" d:LayoutOverrides="Height">

                <TextBlock Foreground="#ffffff" TextWrapping="Wrap" FontSize="26.667" Margin="0,200,0,0" HorizontalAlignment="Center" VerticalAlignment="Center" FontWeight="Light" >
                    <Run Text="Please switch to full screen to view the details."/>
                    <LineBreak/>
                    <Run/>
                    <LineBreak/>
                    <Run Text="" />
                    <LineBreak/>
                    <Run/>
                    <LineBreak/>
                    <LineBreak/>
                    <Run/>
                    <LineBreak/>
                </TextBlock>
            </StackPanel>
            <Image Margin="0,495,0,0" Source="Assets/Images/bg.jpg" Stretch="Fill"/>
        </Grid>
        
        <VisualStateManager.VisualStateGroups>

            <!-- Visual states reflect the application's view state -->
            <VisualStateGroup>
                <VisualState x:Name="FullScreenLandscape"/>
                <VisualState x:Name="Filled"/>

                <!-- The entire page respects the narrower 100-pixel margin convention for portrait -->
                <VisualState x:Name="FullScreenPortrait">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="backButton" Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PortraitBackButtonStyle}"/>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>

                <!-- The back button and title have different styles when snapped -->
                <VisualState x:Name="Snapped">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="backButton" Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SnappedBackButtonStyle}"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="pageTitle" Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SnappedPageHeaderTextStyle}"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="pageTitle" Storyboard.TargetProperty="Margin">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="-30,-30,0,0"/>
                        </ObjectAnimationUsingKeyFrames>

                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="gridSnap" Storyboard.TargetProperty="Visibility">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="MainScroll" Storyboard.TargetProperty="Visibility">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="pageSubTitle" Storyboard.TargetProperty="Visibility">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
    </Grid>
    
</common:LayoutAwarePage>
